package com.love.netty.util;

import com.love.netty.core.interfaces.Attributes;
import io.netty.channel.Channel;
import io.netty.util.Attribute;

/**
 * @ClassName: LoginUtil
 * @Description:
 * @Author: wuj
 * @Date: 2021-06-24 09:43
 **/
public class LoginUtils {

    public static void markAsLogin(Channel channel) {
        channel.attr(Attributes.LOGIN).set(true);
    }

    public static boolean hasLogin(Channel channel) {
        Attribute<Boolean> loginAttr = channel.attr(Attributes.LOGIN);

        return loginAttr.get() != null;
    }
}
